#include <bits/stdc++.h>
#ifndef DEBUG
#define debug
#endif
using namespace std;
using i64 = int64_t;

template <template<typename> typename Cmp = greater, typename T>
vector<int> get_next_prev(vector<T> &arr, bool prev = false) {
  int n = arr.size();
  vector<int> res(n);
  stack<int> st;
  for (int i = prev ? 0 : n - 1; prev ? i < n : i >= 0; prev ? ++i : --i) {
    while (!st.empty() && !Cmp<T>()(arr[st.top()], arr[i])) st.pop();
    res[i] = st.empty() ? (prev ? -1 : n) : st.top();
    st.push(i);
  }
  return res;
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i ++) cin >> a[i];
  auto prev = get_next_prev(a, true);
  auto next = get_next_prev<less>(a);
  vector<int> L(n + 1);
  for (int i = 1; i <= n; i ++) {
    if (prev[i] == -1 || next[i] == n + 1) continue;
    L[next[i]] = max(L[next[i]], prev[i]);
  }
  for (int i = 1; i <= n; i ++) {
    L[i] = max(L[i], L[i - 1]);
  }
  while (m --) {
    int l, r;
    cin >> l >> r;
    if (L[r] < l) cout << "YES\n";
    else cout << "NO\n";
  }
}
int main() {
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  cin >> T;
  for (int cas = 1; cas <= T; cas ++) {
    // cout << "Case #" << cas << ": ";
    solve();
  }
}